<? $page_title='库存汇总' ?>
<? $page_maxitems=60 ?>
<?include "FASHION/page_header.phtml"?>
<div id="printArea" class="horizontal">
<table class="ptop" border="0" cellpadding="4" cellspacing="0" width="100%">
         <thead>
            <tr class="nobg">
                <th colspan="4"><h2><?$print_com_name?></h2></th>
            </tr>
            <tr class="nobg">
                <th colspan="4"><h1><?$page_title?></h1></th>
            </tr>
        </thead>        
    </table>
<table border=0 class="list pcontent" width="100%">
<thead>
	<tr class="nobg">
		<th rowspan="2">编号</th>
		<th rowspan="2">材料名称</th>
		<th rowspan="2">品牌</th>
		<th rowspan="2">规格</th>
		<th rowspan="2">单位</th>
		<th colspan="3">期初结存</th>
		<th colspan="3">本期入库</th>
		<th colspan="3">本期出库</th>
		<th colspan="3">期末结存</th>
		<th rowspan="2">备注</th>
	</tr>
	<tr class="nobg">
		<th>数量</th>
		<th>单价</th>
		<th>金额</th>
		<th>数量</th>
		<th>单价</th>
		<th>金额</th>
		<th>数量</th>
		<th>单价</th>
		<th>金额</th>
		<th>数量</th>
		<th>单价</th>
		<th>金额</th>
	</tr>
        </thead>
        <tbody>
<{if $list}>
<?
$wareheadtotal=0; $wht =0;
$wareintotal=0; $wit =0;
$wareouttotal=0; $wot =0;
$waretailtotal=0; $wtt =0;
?>
<{foreach item=ware from=$list}>
	<tr id="selstf_<{$ware.id}>">
		<td nowrap><{$ware.sno}>&nbsp;</td>
		<td><{$ware.name}>&nbsp;</td>
		<td><{$ware.brand}></td>
		<td width="80"><{$ware.specific}></td>
		<td><{$ware.unit}></td>
	<{if $ware.head}>	
		<td class="decimal"><{$ware.head.bl_amount}></td>
		<td class="fnum"><{$ware.head.bl_price}></td>
		<td class="fnum"><{$ware.head.bl_total}></td>
                <?$wareheadtotal += $ware.head.bl_total;$wht+=$ware.head.bl_amount?>    
	<{else}>
		<td class="decimal">0</td>
		<td class="decimal">0.00</td>
		<td class="decimal">0.00</td>
	<{/if}>	
	<{if $ware.in}>
		<td class="decimal"><{$ware.in.amount}></td>
		<td class="fnum"><{$ware.in.price}></td>
		<td class="fnum"><{$ware.in.total}></td>
                <?$wareintotal += $ware.in.total;$wit+=$ware.in.amount?>
	<{else}>
		<td class="decimal">0</td>
		<td class="decimal">0.00</td>
		<td class="decimal">0.00</td>
	<{/if}>
	
	<{if $ware.out}>
		<td class="decimal"><{$ware.out.amount}></td>
		<td class="fnum"><{$ware.out.price}></td>
		<td class="fnum"><{$ware.out.total}></td>
                <?$wareouttotal += $ware.out.total;$wot+=$ware.out.amount?>
	<{else}>
		<td class="decimal">0</td>
		<td class="decimal">0.00</td>
		<td class="decimal">0.00</td>
	<{/if}>
	<{if $ware.tail}>
		<td class="decimal"><{if $ware.head.bl_amount+$ware.in.amount-$ware.out.amount!=$ware.tail.bl_amount}><b style="color:red"><{$ware.tail.bl_amount}></b><{else}><{$ware.tail.bl_amount}><{/if}></td>
		<td class="fnum"><{$ware.tail.bl_price}></td>
		<td class="fnum"><{$ware.tail.bl_total}></td>
                <?$waretailtotal += $ware.tail.bl_total;$wtt+=$ware.tail.bl_amount?>
	<{else}>
		<td class="decimal">0</td>
		<td class="decimal">0.00</td>
		<td class="decimal">0.00</td>
	<{/if}>	
		<td><{$ware.remark}></td>
	</tr>
        
<{/foreach}>
<tr>
            <td colspan="5">合计</td>
            <td class="fnum"><?$wht?></td>
            <td colspan="2" class="fnum b"><?$wareheadtotal?></td>
            <td class="fnum"><?$wit?></td>
            <td colspan="2" class="fnum b"><?$wareintotal?></td>
            <td class="fnum"><?$wot?></td>
            <td colspan="2" class="fnum b"><?$wareouttotal?></td>
            <td class="fnum"><?$wtt?></td>
            <td colspan="2" class="fnum b"><?$waretailtotal?></td>
            <td></td>
        </tr>
<{/if}>

</tbody>
</table>

<?include "FASHION/page_footer.phtml"?>
